﻿Public Class borrower_users
    Dim MyEngine As New Engine
    Private Sub borrower_users_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            DataGridView1.DataSource = MyEngine.UserDataSource("BORROWER")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
    'Refresh Control
    Sub RefreshMe()
        DataGridView1.DataSource = MyEngine.UserDataSource("BORROWER")

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            Dim AddBorrower As New Borrower
            'Dim t As New Threading.Thread(AddressOf AddBorrower.Add)
            AddBorrower.address = txtborrowers_address.Text
            AddBorrower.contactnumber = txtborrowers_contactnumber.Text
            AddBorrower.firstname = txtborrowers_firstname.Text
            AddBorrower.lastname = txtborrowers_lastname.Text
            AddBorrower.middlename = txtborrowers_middlename.Text
            AddBorrower.section = borrowers_section.Text
            AddBorrower.yearlevel = borrowers_yearlevel.Text
            AddBorrower.username = txtborrowers_id.Text

            AddBorrower.Add()
            If AddBorrower.ReturnB = False Then
                MsgBox(AddBorrower.ReturnString, MsgBoxStyle.Exclamation)
            Else
                MsgBox("Successfully Added!", vbInformation)
                RefreshMe()
            End If
        Catch ex As Exception

        End Try
    End Sub
End Class